﻿@model _PLATFORM.DATA.SELECTION_OPTION

@{
    ViewBag.Title = "Edit";
}

<script type="text/javascript">
    $(document).ready(function () {
        /*
        * Show / Hide Image Upload Element Name
        */
        $("a.a_changeImage").click(function () {
            $("#div_ImageUpload").toggle(300);
        });
    });
</script>
<h2>Edit</h2>

<script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script>

@using (Html.BeginForm("Edit", "SelectionOption", FormMethod.Post, new { enctype="multipart/form-data" })) 
{
    @Html.ValidationSummary(true)
    <fieldset>
        <legend>SELECTION_OPTION</legend>

        @Html.HiddenFor(model => model.SELECTION_OPTION_ID)

        <div class="editor-label">
            @Html.LabelFor(model => model.NAME)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.NAME)
            @Html.ValidationMessageFor(model => model.NAME)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.IMAGE)
        </div>
        <div class="editor-field">
            @{
        var imageName = @Html.DisplayFor(model => model.IMAGE);
        var itemName = @Html.DisplayFor(model => model.NAME);
        var path = Url.Content("~/Content/User/Images/" + imageName);
            }
            @Html.Image(path, @itemName + " image.", new { style = "width:100px;height:75px;", id="CurrentImage" })
            <a href="#" class="a_changeImage" onclick="return false;">Add / Modify Image?</a>
            <div id="div_ImageUpload" style="display:none;">
                <input name="img_imageUpload" type="file" id="imageUpload" value="Upload" />
            </div>
        </div>

        <div class="editor-label">
            @Html.Label("GROUP")
        </div>
        <div class="editor-field">
            @Html.DropDownList("GroupList")
        </div>

        <p>
            <input type="submit" value="Save" />
        </p>
        
    </fieldset>
}

<div>
    @Html.ActionLink("Back to List", "Index")
</div>
